<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .redbox{
            background-color: red;
        }
        .greenbox{
            background-color: green;
        }

        .boderBox{
            border:2px solid black;
        }

        .bigBox{
            width: 400px !important;
            height: 200px !important;
        }

        .smallBox{
            width: 100px;
            height: 100px;
        }

    </style>
</head>

<body>
    <div id="app">
        <input type="button" value="测试01" @click="testfn01">
       <div class="redbox smallBox" :class="{boderBox:isBorder,bigBox:isBig}" >
       </div>
       <hr>
       <input type="button" value="测试02" @click="testfn02">
       <div class="redbox smallBox" :class="arr" >
    </div>
      
    </div>
</body>

</html>
<script src="./js/vue2.js"></script>
<script>


    let vm = new Vue({
        el: "#app",
        data: {
            isBorder:false,
            isBig:false,
            arr:['bigBox']
        },
        methods:{
            testfn01(){
               this.isBorder = !this.isBorder;
               this.isBig = !this.isBig;
            },
            testfn02(){
                this.arr.push('boderBox');
            }
        }
    });

</script>